package com.umgsai.thread.thread64;

public class MyThread extends Thread {
	public MyThread() {
		System.out.println("构造方法中的状态：" + Thread.currentThread().getState());//RUNNABLE
	}
	@Override
	public void run() {
		System.out.println("run方法中的状态：" + Thread.currentThread().getState());//RUNNABLE
		try {
			Thread.sleep(1000);
		} catch (Exception e) {
			// TODO: handle exception
		}
	}
	public static void main(String[] args) {
		try {
			MyThread thread = new MyThread();
			System.out.println("main方法中的状态1：" + thread.getState());//NEW
			Thread.sleep(1000);
			thread.start();
			Thread.sleep(500);
			System.out.println("main方法中的状态2：" + thread.getState());//TIMED_WAITING
			Thread.sleep(1200);
			System.out.println("main方法中的状态3：" + thread.getState());//TERMINATED
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}
